package com.wwg.geoquiz.model

import androidx.lifecycle.ViewModel
import com.wwg.geoquiz.R

private const val TAG = "QuizViewModel"

class QuizViewModel : ViewModel() {
    val questionBank = listOf(
        Question(R.string.question_australia, true, 0),
        Question(R.string.question_oceans, true, 0),
        Question(R.string.question_mideast, false, 0),
        Question(R.string.question_africa, false, 0),
        Question(R.string.question_americas, true, 0),
        Question(R.string.question_asia, true, 0)
    )
    var currentNum = 0
    var chooseList = mutableListOf<Choose?>(null, null, null, null, null, null)
    var score = 0  //得分
    val currentQuestionAnswer: Boolean
        get() = questionBank[currentNum].key
    val questionText: Int
        get() = questionBank[currentNum].question
    val currentQuestion: Question
        get() = questionBank[currentNum]

    fun moveToNext() {
        currentNum = (currentNum + 1) % questionBank.size
    }

    fun moveToLast() {
        currentNum = currentNum - 1
        if (currentNum < 0) currentNum = 5
    }
    fun cheating (cheatTag : Boolean){
        if (cheatTag == true)
            questionBank[currentNum].cheating = true
    }

}